<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link href="../style/fjol_style.css" rel="stylesheet" />
	</head>

	<body>
		
		<div class="mui-content">
		    <div class="mui-scroll-wrapper">
		        <div class="mui-scroll">
		            <!--这里放置真实显示的DOM内容-->
		            <ul class="mui-table-view" id="collectHouseList">
		                
		            </ul>
		        </div>
		    </div>
		    
		</div>
		<script src="../js/mui.min.js"></script>
		<script src="../js/fj_public_js.js"></script>
		<script src="../js/md5.js"></script>
		<script src="../js/network.js"></script>
		<script type="text/javascript" src="../js/generalUtil.js" ></script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(function(){
				var userInfo = common.myStorage.getItem('userInfo');
//				console.log(userInfo.clientId);
				var param = [{
						key: 'clientId',
						value: userInfo.clientId
					}, {
						key: 'page',
						value: 1
					}, {
						key: 'rows',
						value: 30
					}];
				
				var collectHouseList = document.querySelector('#collectHouseList');
				var collectData = new Array();
				fjNetwork.get('fjzx/client/house-collection-list.json',param,function(data){
//					console.log(JSON.stringify(data));
					var rows = data.rows;
					var houseStatus;		//房屋出售类型
					var houseNumber;		//门牌号
					var buildNumber;		//楼号
					var buildingName;		//小区名
					var area;				//区域
					var coverImage;			//图片
					var square;				//楼房面积
					var squarePrice;		//售价
					var totalPrice;			//总价
					var tradingStateName;	//交易状态
					var collectionTotal;	//总收藏数
					var houseTypeEnumValue;	//房屋类型枚举值-普通住宅、自建房、商住两用、别墅
					var bedRoomNumber;		//房间数
					var livingRoomNumber;	//客厅数
					var toiletNumber;		//卫数
					
					for (idx in rows) {

						collectData.push('<li class="mui-table-view-cell" id="'+rows[idx].id+'">');
						collectData.push('<a class="mui-navigate-right" style="padding-right:20px;">');
						
						houseStatus = rows[idx].statusName;
						houseNumber = rows[idx].number;
						buildNumber = rows[idx].buildNumber;
						buildingName = rows[idx].buildingName;
						
						totalPrice = Math.round(rows[idx].totalPrice/10000);
						collectData.push('<img class="mui-pull-left mr5" width="100" height="80" src="'+rows[idx].coverImage+'">');
						collectData.push('<div class="mui-media-body">');
						collectData.push('<div>'+rows[idx].title+'</div>');
		                collectData.push('<div class="mui-ellipsis mui-clearfix mt10">');
		                collectData.push('<span class="mui-badge mui-badge-success mui-badge-inverted f14 mui-pull-right">'+totalPrice+'万</span>');
		                collectData.push('<div>');
		                collectData.push('<h5>'+rows[idx].area+' &nbsp;'+rows[idx].buildingName+'</h5>');
		                collectData.push('<h5>'+rows[idx].bedRoomNumber+'室'+rows[idx].livingRoomNumber+'厅&nbsp;'+rows[idx].square+'平方</h5>');
		                collectData.push('</div>');
		                collectData.push('</div>');
		                collectData.push('</div>');
		                
		                collectData.push('</a>');
		                collectData.push('</li>');
					}
					
					collectHouseList.innerHTML = collectData.join('');

					mui('#collectHouseList li').each(function(){
						this.addEventListener('tap',function(){
							mui.openWindow({
								url:'../house_detail.html',
								id:'house_detail',
								extras:{
									houseId:this.getAttribute('id')
								}
							})
						});
					
				});
				},function(msg){
					mui.toast(msg);
				});
				
			})
			
		</script>
	</body>

</html>